//
//  CarInModel.swift
//
//  Created by 邱仙凯 on 2022/3/24
//  Copyright (c) . All rights reserved.
//

import Foundation
import ObjectMapper

public struct ZyaCarInModel: Mappable {

  // MARK: Declaration for string constants to be used to decode and also serialize.
  private struct SerializationKeys {
    static let carInfo = "carInfo"
    static let cjArrayNew = "cjArrayNew"
    static let zbArrayNew = "zbArrayNew"
  }

  // MARK: Properties
  public var carInfo = [ZyaCarInfo]()
  public var cjArrayNew = [ZyaZbArrayNew]()
  public var zbArrayNew = [ZyaZbArrayNew]()
    public var zbOpen = false
    public var cjOpen = false
  // MARK: ObjectMapper Initializers
  /// Map a JSON object to this class using ObjectMapper.
  ///
  /// - parameter map: A mapping from ObjectMapper.
  public init?(map: Map){

  }

  /// Map a JSON object to this class using ObjectMapper.
  ///
  /// - parameter map: A mapping from ObjectMapper.
  public mutating  func mapping(map: Map) {
    carInfo <- map[SerializationKeys.carInfo]
    cjArrayNew <- map[SerializationKeys.cjArrayNew]
    zbArrayNew <- map[SerializationKeys.zbArrayNew]
  }

  /// Generates description of the object in the form of a NSDictionary.
  ///
  /// - returns: A Key value pair containing all valid values in the object.
  public func dictionaryRepresentation() -> [String: Any] {
    var dictionary: [String: Any] = [:]
    dictionary[SerializationKeys.carInfo] = carInfo.map { $0.dictionaryRepresentation() } 
      dictionary[SerializationKeys.cjArrayNew] = cjArrayNew.map { $0.dictionaryRepresentation() }
 dictionary[SerializationKeys.zbArrayNew] = zbArrayNew.map { $0.dictionaryRepresentation() } 
    return dictionary
  }

}
